package com.xuecheng.user.controller;

import com.xuecheng.user.model.dto.FindPasswordDTO;
import com.xuecheng.user.model.dto.RegisterUserDTO;
import com.xuecheng.user.service.IXcUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 勾新杰
 * @version 1.0
 * @description: 找回密码、注册
 * @date 2025/2/24 22:21
 */
@Api(tags = "用户登录管理")
@RestController
@RequiredArgsConstructor
public class XcUserController {

    private final IXcUserService xcUserService;

    /**
     * 找回密码
     * @param findPasswordDTO 找回密码参数
     */
    @PostMapping("/findpassword")
    @ApiOperation("找回密码")
    public void findPassword(@RequestBody @Validated FindPasswordDTO findPasswordDTO) {
        xcUserService.findPassword(findPasswordDTO);
    }

    /**
     * 注册
     * @param registerUserDTO 注册参数
     */
    @PostMapping("/register")
    @ApiOperation("注册")
    public void register(@RequestBody @Validated RegisterUserDTO registerUserDTO) {
        xcUserService.register(registerUserDTO);
    }
}
